home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 1 / PC Actual CD 01.iso / share / dos / graficos / plydat14.arj / SPOT1.PI < prev    next >
Encoding:
Text File  |  1992-04-05  |  2.1 KB  |  76 lines

  1. viewpoint {
  2.    from <0, 5, -40>
  3.    at <0,0,0>
  4.    up <0,1,0>
  5.    angle 45
  6.    resolution 160, 160
  7.    }
  8.  
  9. background <0, 0.2, 0.3>
  10. bounding_slab <1, 0, 0>
  11. bounding_slab <0, 1, 0>
  12. bounding_slab <0, 0, 1>
  13.  
  14. include "colors.inc"
  15.  
  16. // Make a spotlight with a visible outer surface
  17. define throw_length 20
  18. define throw_radius 10
  19. define throw_offset <0, 15, 0>
  20. define throw_orientation <0, 0, -90>
  21.  
  22. // Now from the definitions of the throw lamp, calculate
  23. // the data needed to build the object
  24. define spot_point  <throw_length, 0, 0>
  25. define throw_dist |P|
  26. define throw_angle atan(throw_radius / throw_length)
  27.  
  28. // Fudge for now - the rotation function is not yet defined.
  29. // define throw_point  rotate(spot_point, throw_orientation) + throw_offset
  30. define throw_point <0, -5, 0>
  31.  
  32. // Build the texture for a spotlight with a fading exterior - the exterior
  33. // shading is sensitive to visibility of the light source as well.
  34. define fading_white
  35. texture {
  36.    special surface {
  37.       color white
  38.       ambient (visible(W, throw_offset) == 0
  39.                ? 0
  40.                : (P[0] < 1 ? 1
  41.                  : (P[0] > throw_length ? 0
  42.                     : (throw_length - P[0]) / throw_length)))
  43.       transmission (visible(W, throw_offset) == 1
  44.                     ? (P[0] < 1 ? 0
  45.                        : (P[0] > throw_length ? 1
  46.                           : P[0] / throw_length))
  47.                     : 1), 1
  48.       }
  49.    }
  50. // The next two things are coupled together - the light source
  51. // and the cone around it to make a visible border.
  52. spot_light white, throw_offset, throw_point, 3,
  53.            degrees(throw_angle), degrees(throw_angle)
  54. object {
  55.    cone <0, 0, 0>, 0.1, spot_point, throw_radius
  56.    fading_white
  57.    rotate throw_orientation
  58.    translate throw_offset
  59.    }
  60.  
  61. // Add a couple of other things to complete the scene
  62. object {
  63.    box <-7, 1, -5>, <7, 2, 5>
  64.    rotate <0, 70, 0>
  65.    shiny_red
  66.    }
  67. object {
  68.    sphere <0, 5, 0>, 2
  69.    reflective_gold
  70.    }
  71. object {
  72.    polygon 4, <-20, -5.05, -20>, <-20, -5.05, 40>,
  73.           < 20, -5.05,  40>, < 20, -5.05,-20>
  74.    texture { checker matte_white, matte_black scale <3, 1, 3> }
  75.    }
  76.